เมนูนำทาง
โปรแกรมเฮลโลเวิลด์ ตัวอย่างของ Hello world ในภาษาโปรแกรมต่าง ๆmessage "Hello, World!" with style = popup;
REPORT ZELLO.WRITE 'Hello, World!'.
WRITE "Hello, world!"
with Ada.Text_IO;procedure Hello isbegin Ada.Text_IO.Put_Line ("Hello, world!") ;end Hello;
For explanation see wikibooks:Ada Programming:Basic.
In the popular upper-case stropping convention for bold words:
BEGIN print (("Hello, World!", newline))END
or using prime stropping suitable for punch cards:
'BEGIN' PRINT (("HELLO, WORLD!", NEWLINE))'END'
or minimally using the short form of begin and end, and implied newline at program termination:
( print ("Hello, World!") )
PROC main () WriteF ('Hello, World!') ;ENDPROC
'Hello World'
See also GUI section.
return "Hello World!"
<%Response.Write ("Hello World")%>or simply:
<%="Hello World" %>
Response.Write ("Hello World")
See the example section of the PDP-8 article.
bdos equ 0005H ; BDOS entry pointstart: mvi c,9 ; BDOS function: output string lxi d,msg$ ; address of msg call bdos ret ; return to CCPmsg$: db 'Hello, world!$'end start
MSG: .ASCIIZ "Hello, world!" LDX #$F3@LP: LDA MSG-$F3,X ; load character JSR $FFD2 ; CHROUT (KERNAL) , output to current output device (screen) INX BNE @LP ; RTS
See the example section of the Nova article.
MODEL SMALLIDEALSTACK 100HDATASEG MSG DB 'Hello, world!', 13, '$'CODESEGStart: MOV AX, @data MOV DS, AX MOV DX, OFFSET MSG MOV AH, 09H ; DOS: output ASCII$ string INT 21H MOV AX, 4C00H INT 21H END Start
format PE GUI 4.0include '%fasminc%\win32a.inc'section '.code' code readable executableinvoke MessageBox,0,hellomsg,hellolb,MB_OK+MB_ICONINFORMATIONinvoke ExitProcess,0section '.data' data readable writablehellomsg db 'Hello, World!',0hellolb db 'Hello World',0data importlibrary user32,'user32.dll',kernel32,'kernel32.dll'include '%fasminc%\apia\user32.inc'include '%fasminc%\apia\kernel32.inc'end data
.datamsg: .ascii "Hello, world!\n" len = . - msg.text .global _start_start: movl $len,%edx movl $msg,%ecx movl $1,%ebx movl $4,%eax int $0x80 movl $0,%ebx movl $1,%eax int $0x80
TERM EQU 19 console device no. (19 = typewriter) ORIG 1000 start addressSTART OUT MSG (TERM) output data at address MSG HLT halt executionMSG ALF "HELLO" ALF " WORL" ALF "D " END START end of program
string BYTE "Hello, world!",#a,0 string to be printed (#a is newline and 0 terminates the string)
Main GETA $255,string get the address of the string in register 255 TRAP 0,Fputs,StdOut put the string pointed to by register 255 to file StdOut TRAP 0,Halt,0 end process
.MCALL .REGDEF,.TTYOUT,.EXIT .REGDEFHELLO: MOV #MSG,R1 MOVB (R1) ,R0LOOP: .TTYOUT MOVB + (R1) ,R0 BNE LOOP .EXITMSG: .ASCIZ /HELLO, WORLD!/ .END HELLO
.title hello
.psect data, wrt, noexechan: .blkw 1iosb: .blkq 1term: .ascid "SYS$OUTPUT"msg: .ascii "Hello, world!"len = . - msg .psect code, nowrt, exe .entry hello, ^m<> ; Establish a channel for terminal I/O $assign_s devnam=term, - chan=chan blbc r0, end ; Queue the I/O request $qiow_s chan=chan, - func=#io$_writevblk, - iosb=iosb, - p1=msg, - p2=#len ; Check the status and the IOSB status blbc r0, end movzwl iosb, r0 ; Return to operating systemend: ret .end hello
.program ADR R0,message SWI "OS_Write0" SWI "OS_Exit".message DCS "Hello, world!" DCB 0 ALIGN
หรือเวอร์ชันย่อ (จาก qUE) ;
SWI"OS_WriteS":EQUS"Hello, world!":EQUB0:ALIGN:MOVPC,R14
MsgBox, "Hello, World!"
MsgBox (1,'','Hello, world!')
BEGIN { print "Hello, world!" }
echo Hello,\ world!
The following example works for any ANSI/ISO-compliant BASIC implementation, as well as most implementations built into or distributed with microcomputers in the 1970s and 1980s (usually some variant of Microsoft BASIC) :
10 PRINT "Hello, world!"20 END
Such implementations of BASIC could also execute instructions in an immediate mode when line numbers are omitted. The following examples work without requiring a RUN instruction.
PRINT "Hello, world!"? "Hello, world!"
Later implementations of BASIC allowed greater support for structured programming and did not require line numbers for source code. The following example works when RUN for the vast majority of modern BASICs.
PRINT "Hello, world!"END
Again, the "END" statement is optional in many BASICs.
DEBUG "Hello, world!", CR
or, the typical microcontroller Hello World program equivalent with the only output device present being a light-emitting diode (LED) (in this case attached to the seventh output pin) :
DO HIGH 7 'Make the 7th pin go high (turn the LED on) PAUSE 500 'Sleep for half a second LOW 7 ' Make the 7th pin go low (turn the LED off) PAUSE 500 'Sleep for half a secondLOOPEND
sub main print "Hello, World"end sub
On TI calculators of the TI-80 through TI-86 range:
:Disp "HELLO, WORLD!" or:Output (x,y,"HELLO, WORLD!") or:Text (x,y,"HELLO, WORLD!") or:Text (-1,x,y,"HELLO, WORLD!") ;only on the 83+ and higher
or simply
:"HELLO, WORLD!"
On TI-89/TI-92 (+) /Voyage 200 calculators:
:hellowld ():Prgm:Disp "Hello, world!":EndPrgm
Sub Main MsgBox "Hello World!"End Sub
Module HelloWorldApp Sub Main () System.Console.WriteLine ("Hello, world!") End SubEnd Module
or, defined differently,
Class HelloWorldApp Shared Sub Main () System.Console.WriteLine ("Hello, world!") End SubEnd Class
Print "Hello, World!"
PRINT "HELLO WORLD"
TEXT 0,0,"Hello World"WAIT KEY
GET "LIBHDR"
LET START () BE$ ( WRITES ("Hello, world!*N")$)
%TITLE 'HELLO_WORLD'MODULE HELLO_WORLD (IDENT='V1.0', MAIN=HELLO_WORLD, ADDRESSING_MODE (EXTERNAL=GENERAL)) =BEGIN LIBRARY 'SYS$LIBRARY:STARLET'; EXTERNAL ROUTINE LIB$PUT_OUTPUT;GLOBAL ROUTINE HELLO_WORLD =BEGIN LIB$PUT_OUTPUT (%ASCID %STRING ('Hello World!'))END;ENDELUDOM
See also GUI Section.
print "Hello, world!"
This program will work on the fx-9750 graphing calculator and compatibles.
"HELLO WORLD"↵
#include <stdio.h>int main(){ printf("Hello, world!"); return 0;}
The above C code can run in Ch as examples. The simple one in Ch is:
printf ("Hello, world\n") ;
See also GUI Section.
class HelloWorldApp{ static void Main () { System.Console.WriteLine ("Hello, world!") ; }}
#include <iostream>using namespace std;int main (){ cout << "Hello, world!\n";}
int main (){ System::Console::WriteLine ("Hello, world!") ;}
#using <mscorlib.dll>using namespace System;int wmain (){ Console::WriteLine ("Hello, world!") ;}
<cfoutput>Hello, world!</cfoutput>
PRINT "Hello, World!"
.method public static void Main () cil managed{ .entrypoint .maxstack 8 ldstr "Hello, world!" call void [mscorlib]System.Console::WriteLine (string) ret}
module helloStart = "Hello, world"
PROC 0WRITE Hello, World!
@1,1 say "Hello World!"
IDENTIFICATION DIVISION.PROGRAM-ID. HELLO-WORLD.ENVIRONMENT DIVISION.DATA DIVISION.PROCEDURE DIVISION.DISPLAY "Hello, world!".STOP RUN.
import std.stdio;void main (){ writefln ("Hello, world!") ;}
[Hello, world!]p
$ write sys$output "Hello, world!"
// The program is itself an object. The program "this" object can be overloaded// as a function that work as "main" function in a C program.this (){ system.stdout ("Hello, World!") ;}
module: helloformat-out ("Hello, world!\n") ;
ahello world!.p
class HELLO_WORLDcreation makefeature make is local io:BASIC_IO do !!io io.put_string ("%N Hello, world!") end -- makeend -- class HELLO_WORLD
-module (hello).-export ([hello_world/0]).hello_world () -> io:fwrite ("Hello, world!\n").
puts (1, "Hello, world!")
print_endline "Hello world"
"Hello world" print
@once mesgbox "Hello, world!" exit
"hello" < main{ main -> stef (;) stofn skrifastreng (;"Halló Veröld!") , stofnlok}*"GRUNNUR";
type "Hello, World!",!
or
t "Hello, World!",!
-TYPE Hello World
begin TOOL HelloWorld;includes Framework;HAS PROPERTY IsLibrary = FALSE;forward Hello;-- START CLASS DEFINITIONSclass Hello inherits from Framework.Objecthas public method Init;has property shared= (allow=off, override=on) ; transactional= (allow=off, override=on) ; monitored= (allow=off, override=on) ; distributed= (allow=off, override=on) ;end class;-- END CLASS DEFINITIONS-- START METHOD DEFINITIONS------------------------------------------------------------method Hello.Initbeginsuper.Init () ;task.Part.LogMgr.PutLine ('HelloWorld!') ;end method;-- END METHOD DEFINITIONSHAS PROPERTY CompatibilityLevel = 0; ProjectType = APPLICATION; Restricted = FALSE; MultiThreaded = TRUE; Internal = FALSE; LibraryName = 'hellowor'; StartingMethod = (class = Hello, method = Init) ;end HelloWorld;
: halloforth ( -- ) ." Hello, world!" CR ;
PROGRAM HELLO PRINT *, 'Hello, world!' END
? ((pp "Hello, world!"))
println["Hello, world!"]
See also GUI section.
PUBLIC SUB Main () Print "Hello, world!"END
In the draw event of some object:
draw_text (x,y,"Hello World")
Or to show a splash screen message:
show_message ("Hello World")
module Main (main) wheremain = putStrLn "Hello World"
or
main = putStrLn "Hello World"
program HelloWorld;functions { _main () { print_string ("Hello, world!") ; }}end
(Handheld Hewlett-Packard RPN-based alphanumeric engineering calculators.)
01 LBLTHELLO02 THELLO, WORLD03 PROMPT
put "Hello world"
or
Answer "Hello World"
print,"Hello world!"
[ Main; print "Hello, world!^";];
"Hello world!" print
or
write ("Hello world!\n")
ON ENTER { "Hello, " "World!" & SAY}
Simplest:
Hello World
Probably closest in semantics:
'Hello World'
include 16f877_20
include hd447804 hd44780_clear hd44780 = "H" hd44780 = "e" hd44780 = "l" hd44780 = "l" hd44780 = "o" hd44780 = " " hd44780 = "W" hd44780 = "o" hd44780 = "r" hd44780 = "l" hd44780 = "d" hd44780 = "!"
See also GUI section.
public class Work_name_or_tag{ public static void main (String[] args) { System.out.println ("Hello, world!") ; }}
(disassembler output of javap -c Hello.class)
public class Hello extends java.lang.Object { public Hello () ; public static void main (java.lang.String[]) ;}Method Hello () 0 aload_0 1 invokespecial #1 <Method java.lang.Object () > 4 returnMethod void main (java.lang.String[]) 0 getstatic #2 <Field java.io.PrintStream out> 3 ldc #3 <String "Hello, world!"> 5 invokevirtual #4 <Method void println (java.lang.String) > 8 return
`0:"Hello world\n"
WriteLine "Hello, world!"
Lisp has many dialects that have appeared over its almost fifty-year history.
(format t "Hello world!~%")
or
(write-line "Hello World!")
or merely:
"Hello World!"
(display "Hello, world!")(newline)
(print "Hello World")
print [hello world!]
or
pr [Hello World!]
In mswlogo only
messagebox [Hi] [Hello World]
print "Hello, world!"
screen:print (1,1,"Hello, world!")screen:flip ()
W "Hello, world!"
print ("Hello, world!") $
print ("Hello, World!") ;
Print["Hello World"]
disp ('Hello World')
max v2;#N vpatcher 10 59 610 459;#P message 33 93 63 196617 Hello world!;#P newex 33 73 45 196617 loadbang;#P newex 33 111 31 196617 print;#P connect 1 0 2 0;#P connect 2 0 0 0;#P pop;
MODULE Hello;FROM Terminal2 IMPORT WriteLn; WriteString;BEGIN WriteString ("Hello, world!") ; WriteLn;END Hello;
notify (player, "Hello, world!") ;
(with the standard command.com interpreter. The @ symbol is optional and prevents the system from repeating the command before executing it. The @ symbol must be omitted on versions of MS-DOS prior to 3.0.)
@echo Hello, world!
: main me @ "Hello, world!" notify;
WRITE "Hello, World!"END
The easiest way to get Nemerle print "Hello, world!" would be that:
System.Console.WriteLine ("Hello, world!") ;
however, in bigger applications the following code would be probably more useful:
using System.Console;module HelloWorld{ Main () :void { WriteLine ("Hello, world!") ; }}
Oberon is both the name of a programming language and an operating system.
Program written for the Oberon operating system:
MODULE Hello; IMPORT Oberon, Texts; VAR W: Texts.Writer; PROCEDURE World*; BEGIN Texts.WriteString (W, "Hello World!") ; Texts.WriteLn (W) ; Texts.Append (Oberon.Log, W.buf) END World;BEGIN Texts.OpenWriter (W)END Hello.
Freestanding Oberon program using the standard Oakwood library:
MODULE Hello; IMPORT Out;BEGIN Out.String ("Hello World!") ; Out.LnEND Hello.
#import <stdio.h>int main () { printf ( "Hello, World!\n" ) ; return 0;}
//An object-oriented version.@interface Hello : Object{ const char str[] = "Hello world";}- (id) hello (void) ;@end@implementation Hello- (id) hello (void){ printf ("%s\n", str) ;}@endint main (void){ Hello *h = [Hello new]; [h hello]; [h free]; return 0;}
int main (int argc, const char * argv[]){ NSLog (@"Hello, World!") ; return 0;}
print_endline "Hello world!"
See also GUI section.
PROC hello: PRINT "Hello, World"ENDP
(object-class request ^action)(startup (strategy MEA) (make request ^action hello))(rule hello (request ^action hello) (write |Hello World!| (crlf)))
module hello (main){ procedure main ( ) { write () |Hello, world!|, '\n'; };};
print "Hello, world!\n"end
program hello (output) ;
begin
writeln ('Hello, world!')
end.
print "Hello, world!\n";
(This is the first example in Learning Perl; the semicolon is optional.)
say "Hello World";
Hello, world!
or
<?php echo "Hello, world!\n";?>
or
<?="Hello, world!\n"?>
(Note: This will not work unless short open tags are enabled.)
int main () { write ("Hello, world!\n") ; return 0;}
-- start anonymous blockset serveroutput on size 10000000;begin dbms_output.enable (1000000) ; dbms_output.put_line ('Hello World!') ;end;-- end anonymous block
Test: proc options (main) reorder; put skip edit ('Hello, world!') (a) ;end Test;
'Hello world' =>
See PDL section
println ("Hello, world!") ;
write ('Hello, world') ,nl.
print "Hello, world!"
หรือใน Python 3.x
print("Hello, world!")
$ENTRY GO{=<Prout 'Hello, world!'>;}
say "Hello, world!"
See also GUI section.
(On Hewlett-Packard HP-28, HP-48 and HP-49 series graphing calculators.)
<< CLLCD "Hello, world!" 1 DISP 0 WAIT DROP>>
See also GUI section.
puts "Hello, world!"
data _null_;put 'Hello, world!';run;
class HELLO_WORLD is main is #OUT+"Hello, world\n"; end; end;
object HelloWorld with Application { Console.println ("Hello, world!") ;}
print "Hello world!"
(note: requires at least one line of input)
sed -ne '1s/.*/Hello, world!/p'
$ include "seed7_05.s7i";
const proc: main is func begin writeln ("Hello, world!") ; end func;
'Hello, World!' print.
BEGIN
OutText ("Hello, world!") ; OutImage;END
Transcript show: 'Hello, world!'; cr
print "Hello, world!\n";
OUTPUT = "Hello, world!"END
class Hello { static public main: args { Console << "Hello, world!\n"; }}
with Spark_IO;--# inherit Spark_IO;--# main_program;procedure Hello_World--# global in out Spark_IO.Outputs;--# derives Spark_IO.Outputs from Spark_IO.Outputs;isbegin Spark_IO.Put_Line (Spark_IO.Standard_Output, "Hello, world!", 0) ;end Hello_World;
OUTPUT = "Hello, world!"END
CREATE TABLE message (text char (15)) ;INSERT INTO message (text) VALUES ('Hello, world!') ;SELECT text FROM message;DROP TABLE message;
or (e.g. Oracle dialect)
SELECT 'Hello, world!' FROM dual;
or (for Oracle's PL/SQL proprietary procedural language)
BEGIN DBMS_OUTPUT.ENABLE (1000000) ; DBMS_OUTPUT.PUT_LINE ('Hello World, from PL/SQL') ;END;
or (e.g. MySQL or PostgreSQL dialect)
SELECT 'Hello, world!';
or (e.g. T-SQL dialect)
PRINT 'Hello, world!'
or (for KB-SQL dialect)
select Null from DATA_DICTIONARY.SQL_QUERYFOOTER or HEADER or DETAIL or FINAL eventwrite "Hello, world!"
RACINE: HELLO_WORLD.NOTIONS:HELLO_WORLD : ecrire ("Hello, world!").
#OUTPUT Hello, world!
See also GUI section.
puts "Hello, world!"
put "Hello, world!"
Declare @Output varchar (16)Set @Output='Hello, world!'Select @Output
or, simpler variations:
Select 'Hello, world!'Print 'Hello, world!'
echo 'Hello, world!'
or
printf '%s' $'Hello, world!\n'
or for a curses interface:
dialog --msgbox 'Hello, world!' 0 0
#include @"pfc\console\console.ph"goal console::init () , stdio::write ("Hello World!").
เมนูนำทาง
โปรแกรมเฮลโลเวิลด์ ตัวอย่างของ Hello world ในภาษาโปรแกรมต่าง ๆใกล้เคียง
โปรแกรมเฮลโลเวิลด์ โปรแกรมจัดการรหัสผ่าน โปรแกรมหน้า วิญญาณอาฆาต โปรแกรมความภักดี โปรแกรมตรวจแก้จุดบกพร่องกนู โปรแกรมป้องกันไวรัส โปรแกรมประยุกต์ โปรแกรมอรรถประโยชน์ โปรแกรมคอมพิวเตอร์ โปรแกรมประยุกต์บนเว็บแหล่งที่มา
WikiPedia: โปรแกรมเฮลโลเวิลด์ http://www.autohotkey.com http://www.php.net/ini.core#ini.short-open-tag http://www.mozilla.org/keymaster/gatekeeper/there.... http://www.w3.org/1999/xhtml http://www.w3.org/TR/html4/strict.dtd http://www.w3.org/TR/html4/struct/global.html http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd